﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using ECC_EXT_Entity;

namespace ECC_EXT_DAO.Dao
{
    public class SeasonTextDao : DaoBase
    {
        public void SaveOrUpdate(SeasonTextEntity _seasonTextEntity)
        {
            using (ISession session = this.SessionFactory.OpenSession())
            {
                using (ITransaction t1 = session.BeginTransaction())
                {
                    session.SaveOrUpdate(_seasonTextEntity);
                    t1.Commit();
                }

            }
        }

        public SeasonTextEntity GetById(SeasonTextEntity _seasonTextEntity)
        {
            using (ISession session = this.SessionFactory.OpenSession())
            {
                return
                    session.Get<SeasonTextEntity>(_seasonTextEntity.Id) as SeasonTextEntity;
            }
        }

        public SeasonTextEntity GetById(long id)
        {
            using (ISession session = this.SessionFactory.OpenSession())
            {
                return
                    session.Get<SeasonTextEntity>(id) as SeasonTextEntity;
            }
        }
    }
}
